package edu.hawaii.halealohacli.command;

import java.util.TimerTask;
import org.wattdepot.client.WattDepotClient;
/**
 * Implements the TimerTask class and uses the existing
 * CurrentPower class to print current power on an interval.
 * 
 * @author Sean Chung
 *
 */
public class MonitorTask extends TimerTask {
  private WattDepotClient client;
  private String source;
 
  /**
   * MonitorTask constructor.
   * @param source Source input from the user.
   * @param client WattDepot client to connect to.
   */
  public MonitorTask(String source, WattDepotClient client) {
    this.client = client;
    this.source = source;
  }
  @Override
  public void run() {
    CurrentPower currentPower = new CurrentPower();
    String[] input = new String[2];
    input[1] = this.source;  
    System.out.println(currentPower.run(input, client));
  }
}

